#	Copyright (C) 2008 Sambit Bikas Pal, IISERK
#	Author: Sambit Bikas Pal , Email: sam@botcyb.org , sambit@iiserkol.ac.in
#
#    This program is free software: you can redistribute it and/or modify
#    it under the terms of the GNU General Public License as published by
#    the Free Software Foundation, either version 3 of the License, or
#    (at your option) any later version.
#
#    This program is distributed in the hope that it will be useful,
#    but WITHOUT ANY WARRANTY; without even the implied warranty of
#    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
#    GNU General Public License for more details.
#
#    You should have received a copy of the GNU General Public License
#    along with this program.  If not, see <http://www.gnu.org/licenses/>.
#
__author__ = 'Sambit Bikas Pal'

from google.appengine.api import urlfetch

class feedfetch:
	def getfeed(self,url):
		try:
			feeds = urlfetch.fetch(url)
			feedtext = feeds.content
			feedtext = feedtext.replace('document.write(\'','')
			feedtext = feedtext.replace('\');','')
			feedtext = """<div id="feed">""" + feedtext + """</div>"""
			
		except:
			feedtext = """
					<div id="feed">
					<p class="feedTitle"><a href="http://groups.google.com/group/iiserk-notices">IISERK Notices</a></p>
					<ul>
					<li><span class="headline">Sorry could not fetch feeds.</span></li>
					</ul>
					</div>
				"""
		return feedtext
